import 'dart:convert';

import 'package:cbec_app/entity/home/content/content_data.dart';
/// page_margin_bottom : 10
/// btn_bgcolor : "#EE3737"
/// page_margin_top : 10
/// title_size : "16"
/// desc_weight : "400"
/// btn_bgcolorend : "#FB0404"
/// title_color : "#323233"
/// automatic : "0"
/// type : "signin"
/// title : "签到"
/// align : "0"
/// page_margin_left : 8
/// bg_image : {"attachment_url":""}
/// uuid : "020b4c28-38f4-48c4-aaff-61               \ne2cba48a00"
/// desc_size : "12"
/// btn_text_color : "#fff"
/// bg_color : "rgba(255, 255, 255, 0)"
/// title_weight : "400"
/// desc_color : "#969799"
/// page_margin_right : 8
/// btn_text : "立即签到"
/// desc : "连续签到获得更多购物金，断签需重新开始"

class SignInHomeData extends ContentData {
  SignInHomeData({
      this.pageMarginBottom, 
      this.btnBgcolor, 
      this.pageMarginTop, 
      this.titleSize, 
      this.descWeight, 
      this.btnBgcolorend, 
      this.titleColor, 
      this.automatic, 
      this.title,
      this.align, 
      this.pageMarginLeft, 
      this.bgImage, 
      this.uuid, 
      this.descSize, 
      this.btnTextColor, 
      this.bgColor, 
      this.titleWeight, 
      this.descColor, 
      this.pageMarginRight, 
      this.btnText, 
      this.desc,}){type = 'signin';}
  @override
  ContentData fromJson(Map<String, dynamic> json) {
    return SignInHomeData.fromJson(json);
  }
  SignInHomeData.fromJson(dynamic json) {
    pageMarginBottom = json['page_margin_bottom'];
    btnBgcolor = json['btn_bgcolor'];
    pageMarginTop = json['page_margin_top'];
    titleSize = json['title_size'];
    descWeight = json['desc_weight'];
    btnBgcolorend = json['btn_bgcolorend'];
    titleColor = json['title_color'];
    automatic = json['automatic'];
    type = json['type'];
    title = json['title'];
    align = json['align'];
    pageMarginLeft = json['page_margin_left'];
    bgImage = json['bg_image'] != null ? BgImage.fromJson(json['bg_image']) : null;
    uuid = json['uuid'];
    descSize = json['desc_size'];
    btnTextColor = json['btn_text_color'];
    bgColor = json['bg_color'];
    titleWeight = json['title_weight'];
    descColor = json['desc_color'];
    pageMarginRight = json['page_margin_right'];
    btnText = json['btn_text'];
    desc = json['desc'];
  }
  int? pageMarginBottom;
  String? btnBgcolor;
  int? pageMarginTop;
  String? titleSize;
  String? descWeight;
  String? btnBgcolorend;
  String? titleColor;
  String? automatic;
  String? title;
  String? align;
  int? pageMarginLeft;
  BgImage? bgImage;
  String? uuid;
  String? descSize;
  String? btnTextColor;
  String? bgColor;
  String? titleWeight;
  String? descColor;
  int? pageMarginRight;
  String? btnText;
  String? desc;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['page_margin_bottom'] = pageMarginBottom;
    map['btn_bgcolor'] = btnBgcolor;
    map['page_margin_top'] = pageMarginTop;
    map['title_size'] = titleSize;
    map['desc_weight'] = descWeight;
    map['btn_bgcolorend'] = btnBgcolorend;
    map['title_color'] = titleColor;
    map['automatic'] = automatic;
    map['type'] = 'signin';
    map['title'] = title;
    map['align'] = align;
    map['page_margin_left'] = pageMarginLeft;
    if (bgImage != null) {
      map['bg_image'] = bgImage?.toJson();
    }
    map['uuid'] = uuid;
    map['desc_size'] = descSize;
    map['btn_text_color'] = btnTextColor;
    map['bg_color'] = bgColor;
    map['title_weight'] = titleWeight;
    map['desc_color'] = descColor;
    map['page_margin_right'] = pageMarginRight;
    map['btn_text'] = btnText;
    map['desc'] = desc;
    return map;
  }

}

/// attachment_url : ""

class BgImage {
  BgImage({
      this.attachmentUrl,});

  BgImage.fromJson(dynamic json) {
    attachmentUrl = json['attachment_url'];
  }
  String? attachmentUrl;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['attachment_url'] = attachmentUrl;
    return map;
  }

}